new Vue({
    el: '#app',
    data() {
        return {
            IO_form: {
                Data: 'employee_organization',//状态
                page: 1,			//页数
                limit: 10			//每页数据条数
            },
            options: [{
                value: '选项1',
                label: '黄金糕'
            }, {
                value: '选项2',
                label: '双皮奶'
            }, {
                value: '选项3',
                label: '蚵仔煎'
            }, {
                value: '选项4',
                label: '龙须面'
            }, {
                value: '选项5',
                label: '北京烤鸭'
            }],
            formData: {},
            IA_tableData: [{
                id: '12987122',
                name: '好滋好味鸡蛋仔',
                category: '江浙小吃、小吃零食',
                desc: '荷兰优质淡奶，奶香浓而不腻',
                address: '上海市普陀区真北路',
                shop: '王小虎夫妻店',
                shopId: '10333'
            }, {
                id: '12987123',
                name: '好滋好味鸡蛋仔',
                category: '江浙小吃、小吃零食',
                desc: '荷兰优质淡奶，奶香浓而不腻',
                address: '上海市普陀区真北路',
                shop: '王小虎夫妻店',
                shopId: '10333'
            }, {
                id: '12987125',
                name: '好滋好味鸡蛋仔',
                category: '江浙小吃、小吃零食',
                desc: '荷兰优质淡奶，奶香浓而不腻',
                address: '上海市普陀区真北路',
                shop: '王小虎夫妻店',
                shopId: '10333'
            }, {
                id: '12987126',
                name: '好滋好味鸡蛋仔',
                category: '江浙小吃、小吃零食',
                desc: '荷兰优质淡奶，奶香浓而不腻',
                address: '上海市普陀区真北路',
                shop: '王小虎夫妻店',
                shopId: '10333'
            }],		//表格数据
            II_total: 1,
            dialogForm: false,
            title: '',
            multipleSelection: [],
            data: [{
                label: '一级 1',
                children: [{
                    label: '二级 1-1',
                    children: [{
                        label: '三级 1-1-1'
                    }]
                }]
            }, {
                label: '一级 2',
                children: [{
                    label: '二级 2-1',
                    children: [{
                        label: '三级 2-1-1'
                    }]
                }, {
                    label: '二级 2-2',
                    children: [{
                        label: '三级 2-2-1'
                    }]
                }]
            }, {
                label: '一级 3',
                children: [{
                    label: '二级 3-1',
                    children: [{
                        label: '三级 3-1-1'
                    }]
                }, {
                    label: '二级 3-2',
                    children: [{
                        label: '三级 3-2-1'
                    }]
                }]
            }],
            defaultProps: {
                children: 'children',
                label: 'label'
            },
            IB_loading: false
        }
    },
    mounted() {
        this.getList(this.IO_form)
    },
    methods: {
        handleNodeClick(data) {
            console.log(data);
        },
        handleSizeChange(val) {
            this.form.page = 1;
            this.form.limit = val;
            this.getList(this.form)
        },
        //号码按键查询
        handleCurrentChange(val) {
            this.form.page = val;
            this.getList(this.form)
        },
        getList(Arg) {     //换页方法
            let LF_this = this
            $.ajax({
                type: 'POST',
                url: DomainName + "/getTableInquiryAction?token=" + $.cookie('token'),
                data: Arg,
                complete: function (XMLHttpRequest) {
                    if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                        window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                    }
                },
                success: function (Result) {
                    console.log(Result);
                    LF_this.IA_tableData = Result.tableData      //将获取的数据存到表格数据中
                    LF_this.II_total = Number(Result.limit)
                },
                dataType: "json"
            });
        },
        RdcOrganization(Arg) {
            this.$confirm('确认删除该组织, 是否继续?', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
            }).then(() => {
                this.IB_loading = true
                Arg.Row_Status = '1'
                const LF_this = this
                console.log(Arg)
                $.ajax({
                    type: 'POST',
                    url: DomainName + "/getEditAction?token=" + $.cookie('token'),
                    data: {
                        Data: JSON.stringify(
                            {
                                Modify: { employee_organization: [Arg] },
                            }
                        ),
                    },
                    complete: function (XMLHttpRequest) {
                        LF_this.IB_loading = false
                        if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                            window.parent.document.location.href = "../../../" + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                        }
                    },
                    success: function (Result) {
                        console.log(Result);
                        if (Result.Status == 'success') {
                            LF_this.$message({
                                type: 'success',
                                message: '删除成功!'
                            });
                        } else {
                            LF_this.$message({
                                type: 'error',
                                message: '删除失败!'
                            });
                        }
                        LF_this.IB_loading = false
                        LF_this.getList(LF_this.IO_form)
                    },
                    dataType: "json"
                });
            }).catch(() => {
                this.$message({
                    type: 'info',
                    message: '已取消删除'
                });
            });
        },
        EditOrganization(Arg) {
            window.sessionStorage.setItem('Organization_SerialNumber', Arg.Organization_SerialNumber)
            window.location.href = './Edit.html'
        },
        Addemployee() {
            window.location.href = './Add.html'
        }
    },
})